const joi = require('joi')

// 定义 密码 的验证规则
const id = joi.string().alphanum().min(1).max(10).required()
const oldpassword = joi
  .string()
  .pattern(/^[\S]{6,12}$/)
  .min(6)
  .max(12)
  .required()
const newpassword = joi
  .string()
  .pattern(/^[\S]{6,12}$/)
  .min(6)
  .max(12)
  .required()
const nextpassword = joi
  .string()
  .pattern(/^[\S]{6,12}$/)
  .min(6)
  .max(12)
  .required()

exports.updateUserPassword_limit = {
  // 表示需要对 req.body 中的数据进行验证
  body: {
    id,
    oldpassword,
    newpassword,
    nextpassword
  }
}
